﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace Seagull.UdpReceiver
{
    public static class Program
    {
        public static void Main()
        {
            using (var udpClient = new UdpClient(3501))
            {
                var remoteEP = new IPEndPoint(IPAddress.Any, 0);
                using (var fileStream = File.Open("data.dat", FileMode.Create))
                {
                    while (true)
                    {
                        var bytes = udpClient.Receive(ref remoteEP);
                        fileStream.Write(bytes, 0, bytes.Length);
                    }
                }
            }
        }
    }
}
